inherited fmFilter: TfmFilter
  Left = 459
  Top = 157
  Width = 818
  Height = 461
  BorderIcons = [biSystemMenu]
  Caption = #1055#1086#1089#1090#1088#1086#1077#1085#1080#1077' '#1092#1080#1083#1100#1090#1088#1072
  Constraints.MinHeight = 461
  Constraints.MinWidth = 818
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 407
    Width = 810
  end
  inherited Panel1: TPanel
    Top = 362
    Width = 810
    Align = alBottom
    Visible = False
    inherited BitBtn1: TBitBtn
      Left = 261
    end
    inherited BitBtn2: TBitBtn
      Left = 349
    end
  end
  object dbgClients: TcxGrid [2]
    Left = 449
    Top = 57
    Width = 361
    Height = 283
    Align = alClient
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 2
    LookAndFeel.Kind = lfStandard
    object dbgClientsDBTableView1: TcxGridDBTableView
      OnDblClick = cxButton1Click
      NavigatorButtons.ConfirmDelete = False
      NavigatorButtons.First.Visible = True
      NavigatorButtons.PriorPage.Visible = True
      NavigatorButtons.Prior.Visible = True
      NavigatorButtons.Next.Visible = True
      NavigatorButtons.NextPage.Visible = True
      NavigatorButtons.Last.Visible = True
      NavigatorButtons.Insert.Visible = False
      NavigatorButtons.Append.Visible = False
      NavigatorButtons.Delete.Visible = False
      NavigatorButtons.Edit.Visible = False
      NavigatorButtons.Post.Visible = False
      NavigatorButtons.Cancel.Visible = False
      NavigatorButtons.Refresh.Visible = False
      NavigatorButtons.SaveBookmark.Visible = False
      NavigatorButtons.GotoBookmark.Enabled = False
      NavigatorButtons.GotoBookmark.Visible = False
      NavigatorButtons.Filter.Visible = False
      FilterBox.CustomizeDialog = False
      FilterBox.Visible = fvNever
      DataController.DataSource = dlgDS
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <
        item
          Kind = skCount
          FieldName = 'SID'
          DisplayText = #1042#1089#1077#1075#1086' '#1085#1072#1081#1076#1077#1085#1086' '#1089#1086#1080#1089#1082#1072#1090#1077#1083#1077#1081
        end>
      DataController.Summary.SummaryGroups = <>
      DataController.Summary.Options = [soNullIgnore]
      OptionsBehavior.ImmediateEditor = False
      OptionsBehavior.IncSearch = True
      OptionsBehavior.ColumnHeaderHints = False
      OptionsCustomize.ColumnFiltering = False
      OptionsCustomize.ColumnGrouping = False
      OptionsData.CancelOnExit = False
      OptionsData.Deleting = False
      OptionsData.DeletingConfirmation = False
      OptionsData.Editing = False
      OptionsData.Inserting = False
      OptionsSelection.HideFocusRectOnExit = False
      OptionsView.NavigatorOffset = 5
      OptionsView.NoDataToDisplayInfoText = ' '
      OptionsView.CellAutoHeight = True
      OptionsView.CellTextMaxLineCount = 2
      OptionsView.ColumnAutoWidth = True
      OptionsView.GroupByBox = False
      OptionsView.Header = False
      OptionsView.HeaderAutoHeight = True
      OptionsView.HeaderEndEllipsis = True
      OptionsView.Indicator = True
      OptionsView.ShowColumnFilterButtons = sfbAlways
      Styles.IncSearch = DMInv.cxGreenText
      object dbgClientsDBTableView1TFNAME: TcxGridDBColumn
        DataBinding.FieldName = 'TFNAME'
      end
    end
    object dbgClientsLevel1: TcxGridLevel
      GridView = dbgClientsDBTableView1
    end
  end
  object dbTW: TdxDBTreeView [3]
    Left = 0
    Top = 57
    Width = 409
    Height = 283
    ShowNodeHint = True
    AutoExpand = True
    HotTrack = True
    RowSelect = True
    DataSource = dsSD
    DisplayField = 'SDNAME'
    KeyField = 'SDID'
    ListField = 'SDNAME'
    ParentField = 'SDPARID'
    RootValue = 0
    SeparatedSt = '-'
    RaiseOnError = True
    ReadOnly = True
    Indent = 19
    Align = alLeft
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clBlack
    Font.Height = -13
    Font.Name = 'Arial'
    Font.Style = []
    ParentColor = False
    Options = [trCanDBNavigate]
    SortType = stText
    SelectedIndex = 1
    TabOrder = 3
    OnDblClick = bAddClick
    ParentFont = False
    ParentShowHint = False
    ShowHint = False
    StateImages = DMInv.ilBJTree
  end
  object Panel2: TPanel [4]
    Left = 0
    Top = 0
    Width = 810
    Height = 57
    Align = alTop
    BevelOuter = bvNone
    TabOrder = 4
    object Label5: TLabel
      Left = 4
      Top = 5
      Width = 101
      Height = 16
      Caption = #1040#1074#1090#1086#1088' '#1079#1072#1074#1077#1076#1077#1085#1080#1103
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      Visible = False
    end
    object edStr: TcxTextEdit
      Tag = 2
      Left = 4
      Top = 24
      TabStop = False
      ParentFont = False
      Properties.ReadOnly = True
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -15
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = [fsBold]
      Style.Shadow = False
      Style.IsFontAssigned = True
      TabOrder = 0
      Width = 625
    end
    object BitBtn3: TBitBtn
      Left = 638
      Top = 25
      Width = 75
      Height = 25
      TabOrder = 1
      OnClick = BitBtn3Click
      Kind = bkOK
    end
    object BitBtn4: TBitBtn
      Left = 719
      Top = 25
      Width = 75
      Height = 25
      Caption = #1054#1090#1084#1077#1085#1072
      TabOrder = 2
      OnClick = BitBtn4Click
      Kind = bkCancel
    end
  end
  object Panel3: TPanel [5]
    Left = 409
    Top = 57
    Width = 40
    Height = 283
    Align = alLeft
    AutoSize = True
    BevelOuter = bvNone
    TabOrder = 5
    object bAdd: TcxButton
      Left = 0
      Top = 17
      Width = 40
      Height = 41
      Hint = #1044#1086#1073#1072#1074#1080#1090#1100
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -16
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      ParentShowHint = False
      ShowHint = True
      TabOrder = 0
      OnClick = bAddClick
      Colors.Default = clGreen
      Glyph.Data = {
        56020000424D560200000000000076000000280000001E0000001E0000000100
        040000000000E001000000000000000000001000000000000000000000000000
        8000008000000080800080000000800080008080000080808000C0C0C0000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00000000000000
        00000000000000000000077777777777777777777777777770000F7777777777
        777777777777777770000F8888888888888888888888888770000F8888888888
        888888888888888770000F88888888888888888888888887700A0F8888888888
        8888888888888887702C0F88888888888888888888888887704C0F8888888888
        888888888888888770900F88888888FF888888888888888770A80F8888888878
        FF8888888888888770150F888888887008FF88888888888770420F8888888870
        0008FF888888888770260F8888888870000008FF8888888770000F8888888870
        00000008FF88888770070F8888888870000000000778888770880F8888888870
        000000077888888770000F8888888870000007788888888770000F8888888870
        000778888888888770000F8888888870077888888888888770000F8888888877
        788888888888888770020F8888888878888888888888888770040F8888888888
        888888888888888770090F8888888888888888888888888770020F8888888888
        888888888888888770040F8888888888888888888888888770090F8888888888
        888888888888888770020F8888888888888888888888888770040FFFFFFFFFFF
        FFFFFFFFFFFFFFFF700000000000000000000000000000000000}
      LookAndFeel.Kind = lfFlat
      LookAndFeel.SkinName = ''
    end
    object bExtend: TcxButton
      Left = 2
      Top = 70
      Width = 38
      Height = 38
      Hint = #1044#1086#1087#1086#1083#1085#1080#1090#1100
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -16
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      ParentShowHint = False
      ShowHint = True
      TabOrder = 1
      OnClick = bExtendClick
      Colors.Default = clGreen
      Glyph.Data = {
        56020000424D560200000000000076000000280000001E0000001E0000000100
        040000000000E001000000000000000000001000000000000000000000000000
        8000008000000080800080000000800080008080000080808000C0C0C0000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00000000000000
        00000000000000000000077777777777777777777777777770000F7777777777
        777777777777777770000F8888888888888888888888888770000F8888888888
        888888888888888770000F88888888888888888888888887700A0F8888888888
        8888888888888887702C0F88888888888888888888888887704C0F8888888888
        888888888888888770900F8888888888888888888888888770A80F887F888888
        887F88888888888770150F8878FF88888878FF888888888770420F887008FF88
        887008FF8888888770A60F88700008FF88700008FF88888770000F8870000008
        FF70000008FF888770270F8870000000077000000007788770CA0F8870000007
        787000000778888770A60F8870000778887000077888888770000F8870077888
        887007788888888770250F8877788888887778888888888770CA0F8878888888
        887888888888888770A60F8888888888888888888888888770000F8888888888
        888888888888888770250F8888888888888888888888888770CA0F8888888888
        888888888888888770A60F8888888888888888888888888770000F8888888888
        888888888888888770250F8888888888888888888888888770CA0FFFFFFFFFFF
        FFFFFFFFFFFFFFFF702600000000000000000000000000000000}
      LookAndFeel.Kind = lfFlat
      LookAndFeel.SkinName = ''
    end
    object cxButton1: TcxButton
      Left = 1
      Top = 118
      Width = 39
      Height = 37
      Hint = #1059#1076#1072#1083#1080#1090#1100
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -16
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      ParentShowHint = False
      ShowHint = True
      TabOrder = 2
      OnClick = cxButton1Click
      Colors.Default = clRed
      Glyph.Data = {
        56020000424D560200000000000076000000280000001E0000001E0000000100
        040000000000E001000000000000000000001000000000000000000000000000
        8000008000000080800080000000800080008080000080808000C0C0C0000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00000000000000
        00000000000000000000077777777777777777777777777770000F7777777777
        777777777777777770000F8888888888888888888888888770000F8888888888
        888888888888888770000F88888888888888888888888887700A0F8888888888
        8888888888888887702C0F88888888888888888888888887704C0F8888888888
        888888888888888770900F8888888888888888FF8888888770A80F8888888888
        8888FF8F8888888770150F888888888888FF800F8888888770420F8888888888
        FF80000F8888888770A60F88888888FF8000000F8888888770000F888888FF80
        0000000F8888888770250F88888770000000000F8888888770CA0F8888888770
        0000000F8888888770260F88888888877000000F8888888770000F8888888888
        8770000F8888888770070F88888888888887700F8888888770880F8888888888
        8888877F8888888770000F88888888888888888F8888888770000F8888888888
        888888888888888770000F8888888888888888888888888770000F8888888888
        888888888888888770560F8888888888888888888888888770DD0F8888888888
        888888888888888770000F8888888888888888888888888770000FFFFFFFFFFF
        FFFFFFFFFFFFFFFF700000000000000000000000000000000000}
      LookAndFeel.Kind = lfFlat
      LookAndFeel.SkinName = ''
    end
  end
  object pEdit: TPanel [6]
    Left = 0
    Top = 340
    Width = 810
    Height = 22
    Align = alBottom
    BevelOuter = bvNone
    TabOrder = 6
    Visible = False
    object bAddNode: TcxButton
      Left = 0
      Top = 0
      Width = 75
      Height = 22
      Caption = #1044#1086#1073#1072#1074#1080#1090#1100
      TabOrder = 0
      OnClick = bAddNodeClick
      Align = alLeft
    end
    object bEditNode: TcxButton
      Left = 75
      Top = 0
      Width = 110
      Height = 22
      Caption = #1056#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1090#1100
      TabOrder = 1
      OnClick = bEditNodeClick
      Align = alLeft
    end
    object bDelete: TcxButton
      Left = 185
      Top = 0
      Width = 75
      Height = 22
      Caption = #1059#1076#1072#1083#1080#1090#1100
      TabOrder = 2
      OnClick = bDeleteClick
      Align = alLeft
    end
  end
  inherited dlgDS: TDataSource
    DataSet = qFilter
    Left = 216
    Top = 16
  end
  object qFilter: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qFilterAfterInsert
    AfterOpen = qFilterAfterOpen
    CachedUpdates = True
    SQL.Strings = (
      'SELECT TF.*'
      'FROM TEMP_FILTER TF'
      'WHERE TF.USER_NAME = CURRENT_USER'
      '    AND TF.TFNUM = :TFNUM')
    UpdateObject = IBUpdateSQL1
    GeneratorField.Field = 'TFID'
    GeneratorField.Generator = 'GEN_TEMP_FILTER_ID'
    Left = 248
    Top = 16
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'TFNUM'
        ParamType = ptUnknown
      end>
    object qFilterTFID: TIntegerField
      FieldName = 'TFID'
      Origin = '"TEMP_FILTER"."TFID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qFilterTFNUM: TIntegerField
      FieldName = 'TFNUM'
      Origin = '"TEMP_FILTER"."TFNUM"'
    end
    object qFilterUSER_NAME: TIBStringField
      FieldName = 'USER_NAME'
      Origin = '"TEMP_FILTER"."USER_NAME"'
      Size = 40
    end
    object qFilterTFNAME: TIBStringField
      FieldName = 'TFNAME'
      Origin = '"TEMP_FILTER"."TFNAME"'
      Size = 255
    end
    object qFilterTKOL: TIntegerField
      FieldName = 'TKOL'
      Origin = '"TEMP_FILTER"."TKOL"'
    end
    object qFilterTFSQLTEXT: TBlobField
      FieldName = 'TFSQLTEXT'
      Origin = '"TEMP_FILTER"."TFSQLTEXT"'
      ProviderFlags = [pfInUpdate]
      Size = 8
    end
  end
  object IBUpdateSQL1: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  TFID,'
      '  TFNUM,'
      '  USER_NAME,'
      '  TFNAME,'
      '  TFSQLTEXT,'
      '  TDATE,'
      '  TKOL'
      'from TEMP_FILTER '
      'where'
      '  TFID = :TFID')
    ModifySQL.Strings = (
      'update TEMP_FILTER'
      'set'
      '  TDATE = :TDATE,'
      '  TFID = :TFID,'
      '  TFNAME = :TFNAME,'
      '  TFNUM = :TFNUM,'
      '  TFSQLTEXT = :TFSQLTEXT,'
      '  TKOL = :TKOL,'
      '  USER_NAME = CURRENT_USER'
      'where'
      '  TFID = :OLD_TFID')
    InsertSQL.Strings = (
      'insert into TEMP_FILTER'
      '  (TDATE, TFID, TFNAME, TFNUM, TFSQLTEXT, TKOL, USER_NAME)'
      'values'
      
        '  (:TDATE, :TFID, :TFNAME, :TFNUM, :TFSQLTEXT, :TKOL, CURRENT_US' +
        'ER)')
    DeleteSQL.Strings = (
      'delete from TEMP_FILTER'
      'where'
      '  TFID = :OLD_TFID')
    Left = 280
    Top = 16
  end
  object dsSD: TDataSource
    DataSet = qSD
    Left = 448
    Top = 360
  end
  object qTree: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT LIST(t1.sdid, '#39', '#39') AS list_sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID = :SDID'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      'INNER JOIN SYS_DIC sd1 ON sd1.SDID = t1.sdid'
      'WHERE sd1.SDISDELETE = 0 and NOT EXISTS'
      '('
      'SELECT t2.sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID = :SDID'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t2'
      'INNER JOIN SYS_DIC sd1 ON sd1.SDID = t1.sdid'
      'WHERE sd1.SDISDELETE = 0 and t2.sdparid = t1.sdid'
      ')')
    GeneratorField.Field = 'SDID'
    Left = 536
    Top = 360
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SDID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'SDID'
        ParamType = ptUnknown
      end>
    object qTreeLIST_SDID: TMemoField
      FieldName = 'LIST_SDID'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
  end
  object qSD: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE SYS_DIC'
      'SET SDNAME = :SDNAME'
      'WHERE (SDID = :SDID)'
      '')
    DeleteSQL.Strings = (
      'UPDATE SYS_DIC'
      'SET SDISDELETE = 0'
      'WHERE (SDID = :SDID)')
    InsertSQL.Strings = (
      
        'INSERT INTO SYS_DIC (SDID, SDPARID, SDNAME, SDISDELETE) VALUES (' +
        'gen_id(GEN_SYS_DIC,1), :SDPARID, :SDNAME, 0)')
    RefreshSQL.Strings = (
      'SELECT sdparid, sdid, sdname, SDISDELETE'
      'FROM SYS_DIC'
      'WHERE SDID = :SDID')
    SelectSQL.Strings = (
      'SELECT t1.sdparid, t1.sdid, t1.sdname, t1.SDISDELETE'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID, SDISDELETE)'
      
        '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID, sd.SDISDELETE FROM' +
        ' SYS_DIC SD'
      '      WHERE sd.SDPARID = :SDPARID'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID, sd1.SDISDELETE'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID, SDISDELETE FROM tree t'
      ') AS t1'
      'WHERE t1.SDISDELETE = 0')
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    UpdateTransaction = DMInv.trFibWrite
    AutoCommit = True
    Left = 264
    Top = 184
    oFetchAll = True
    object qSDSDID: TIntegerField
      FieldName = 'SDID'
    end
    object qSDSDPARID: TIntegerField
      FieldName = 'SDPARID'
    end
    object qSDSDNAME: TStringField
      FieldName = 'SDNAME'
      Size = 250
    end
    object qSDSDISDELETE: TIntegerField
      FieldName = 'SDISDELETE'
    end
  end
  object qDeleteCheck: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'SELECT'
      '  i.RDB$RELATION_NAME AS table_name,'
      '  s.RDB$FIELD_NAME AS field_name'
      'FROM RDB$INDEX_SEGMENTS s'
      'LEFT JOIN RDB$INDICES i ON i.RDB$INDEX_NAME = s.RDB$INDEX_NAME'
      
        'LEFT JOIN RDB$RELATION_CONSTRAINTS rc ON rc.RDB$INDEX_NAME = s.R' +
        'DB$INDEX_NAME'
      
        'LEFT JOIN RDB$REF_CONSTRAINTS refc ON rc.RDB$CONSTRAINT_NAME = r' +
        'efc.RDB$CONSTRAINT_NAME'
      
        'LEFT JOIN RDB$RELATION_CONSTRAINTS rc2 ON rc2.RDB$CONSTRAINT_NAM' +
        'E = refc.RDB$CONST_NAME_UQ'
      
        'LEFT JOIN RDB$INDICES i2 ON i2.RDB$INDEX_NAME = rc2.RDB$INDEX_NA' +
        'ME'
      'WHERE rc.RDB$CONSTRAINT_TYPE = '#39'FOREIGN KEY'#39
      '  and i2.RDB$RELATION_NAME = '#39'SYS_DIC'#39
      'ORDER BY s.RDB$FIELD_POSITION')
    Left = 312
    Top = 184
    qoStartTransaction = True
  end
  object qMKCheck: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select * from CHECK_SD_FIXED(:SDID)')
    Left = 312
    Top = 232
    qoStartTransaction = True
  end
end
